﻿//using NUnitForVSTS;
//using Microsoft.VisualStudio.TestTools.UnitTesting;
//using System;
//using System.Linq;
//using System.Reflection;
//using System.Collections.Generic;
//using System.IO;
//using System.Runtime.Remoting;
//using NUnitForVSTS.NUnitTest;

//// We are using multiple namespaces with muliple classes with the same name, different meaning
//// Therefore some alliasses to improve clarity
//using TestTarget = NUnitTest.UnitTest.Targets;
//using NUnitSide = NUnit.Core;
//using MSTestSide = Microsoft.VisualStudio.TestTools.Common;

//namespace NUnitForVSTS.NUnitTest.UT
//{
    
    
//    /// <summary>
//    ///This is a test class for AssemblyResolverTest and is intended
//    ///to contain all AssemblyResolverTest Unit Tests
//    ///</summary>
//    [TestClass()]
//    public class AssemblyResolverTest
//    {


//        private TestContext testContextInstance;

//        /// <summary>
//        ///Gets or sets the test context which provides
//        ///information about and functionality for the current test run.
//        ///</summary>
//        public TestContext TestContext
//        {
//            get
//            {
//                return testContextInstance;
//            }
//            set
//            {
//                testContextInstance = value;
//            }
//        }

//        #region Additional test attributes
//        // 
//        //You can use the following additional attributes as you write your tests:
//        //
//        //Use ClassInitialize to run code before running the first test in the class
//        //[ClassInitialize()]
//        //public static void MyClassInitialize(TestContext testContext)
//        //{
//        //}
//        //
//        //Use ClassCleanup to run code after all tests in a class have run
//        //[ClassCleanup()]
//        //public static void MyClassCleanup()
//        //{
//        //}
//        //
//        //Use TestInitialize to run code before running each test
//        //[TestInitialize()]
//        //public void MyTestInitialize()
//        //{
//        //}
//        //
//        //Use TestCleanup to run code after each test has run
//        //[TestCleanup()]
//        //public void MyTestCleanup()
//        //{
//        //}
//        //
//        #endregion


//        /// <summary>
//        ///A test for SetSearchDirectories
//        ///</summary>
//        [TestMethod()]
//        [ExpectedException(typeof(ArgumentNullException))]
//        public void SetSearchDirectoriesTest()
//        {
//            AssemblyResolver target = new AssemblyResolver();
//            List<string> dirs = null;
//            target.SetSearchDirectories(dirs);
//        }

//        /// <summary>
//        ///A test for InitializeLifetimeService
//        ///</summary>
//        [TestMethod()]
//        public void InitializeLifetimeServiceTest()
//        {
//            AssemblyResolver target = new AssemblyResolver();
//            object expected = null; // Infinite lifetime
//            object actual;
//            actual = target.InitializeLifetimeService();
//            Assert.AreEqual(expected, actual);
//        }

//        /// <summary>
//        ///A test for Dispose
//        ///</summary>
//        [TestMethod()]
//        public void DisposeTest()
//        {
//            using (AssemblyResolver usingTarget = new AssemblyResolver())
//            {
//            }

//            AssemblyResolver target = new AssemblyResolver();
//            target.Dispose();
//            target.Dispose(); //double dispose
//        }

//        /// <summary>
//        ///A test for AssemblyResolver Constructor
//        ///</summary>
//        [TestMethod()]
//        public void AssemblyResolverConstructorLoadTest()
//        {
//            Type resolver = typeof(AssemblyResolver);

//            AppDomain app = AppDomain.CreateDomain("Testdomain");
//            Assembly testTargetAssembly = typeof(TestTarget.TestFixtureSetupCorrect).Assembly;
//            string[] directory = {Path.GetDirectoryName(testTargetAssembly.Location)};

//            Assembly[] before = app.GetAssemblies();
//            Assert.IsFalse(before.Contains(testTargetAssembly), "Assembly should not already be loaded");

//            AssemblyResolver target = app.CreateInstanceFromAndUnwrap(resolver.Assembly.Location, resolver.FullName, 
//                    false,
//                    BindingFlags.Public| BindingFlags.Instance,
//                    null,
//                    new object[]{ directory}, 
//                    null, 
//                    null,GetType().Assembly.Evidence) as AssemblyResolver;

//            app.Load(testTargetAssembly.FullName);

//            Assembly[] after = app.GetAssemblies();
//            Assert.IsTrue(after.Contains(testTargetAssembly), "Assembly should now be loaded");

//            target.Dispose();
//        }

//        /// <summary>
//        ///A test for AssemblyResolver Constructor
//        ///</summary>
//        [TestMethod()]
//        public void AssemblyResolverConstructorTest()
//        {
//            AssemblyResolver target = new AssemblyResolver();
//            string actual = target.ToString();
//            Assert.IsNotNull(actual);
//        }
//    }
//}
